package com.ganmiao.server.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ganmiao.server.sys.entity.SysRoleMenu;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 角色菜单信息
 */
@Mapper
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {

    /**
     * 新增角色菜单信息
     *
     * @param sysRoleMenus
     * @return
     */
    @Insert({
            "<script>",
            "insert into sys_role_menu (role_id,menu_id,menu_list) values",
            "<foreach collection = 'list' item = 'sysRoleMenu' separator = ','>",
            "(#{sysRoleMenu.roleId},#{sysRoleMenu.menuId},#{sysRoleMenu.menuList})",
            "</foreach>",
            "</script>"
    })
    boolean addSysRoleMenu(List<SysRoleMenu> sysRoleMenus);

}
